package com.adcc.ags.cgw.configuration;

import com.adcc.ags.cgw.proxy.ConnectionFactory;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * AMQS配置工厂
 */
public class AMQSFactory {

    // MQ 连接配置工厂
    @NotNull
    private List<ConnectionFactory> amqsFactoryList = Lists.newArrayListWithExpectedSize(4);

    // ActiveMode
    @Min(0)
    @Max(2)
    private int activeMode;

    // 连接超时时间
    @Min(0)
    @Max(3600000)
    private long timeout;

    // 最大连接数
    @Min(0)
    @Max(9192)
    private int maxConnections;

    // 最大空闲连接数
    @Min(0)
    @Max(2048)
    private int maxIdelConnections;

    @JsonProperty("connectionList")
    public List<ConnectionFactory> getAmqsFactoryList() {
        return amqsFactoryList;
    }

    @JsonProperty("connectionList")
    public void setAmqsFactoryList(List<ConnectionFactory> amqsFactoryList) {
        this.amqsFactoryList = amqsFactoryList;
    }

    @JsonProperty("activeMode")
    public int getActiveMode() {
        return activeMode;
    }

    @JsonProperty("activeMode")
    public void setActiveMode(int activeMode) {
        this.activeMode = activeMode;
    }

    @JsonProperty("timeout")
    public long getTimeout() {
        return timeout;
    }

    @JsonProperty("timeout")
    public void setTimeout(long timeout) {
        this.timeout = timeout;
    }

    @JsonProperty("maxConnections")
    public int getMaxConnections() {
        return maxConnections;
    }

    @JsonProperty("maxConnections")
    public void setMaxConnections(int maxConnections) {
        this.maxConnections = maxConnections;
    }

    @JsonProperty("maxIdelConnections")
    public int getMaxIdelConnections() {
        return maxIdelConnections;
    }

    @JsonProperty("maxIdelConnections")
    public void setMaxIdelConnections(int maxIdelConnections) {
        this.maxIdelConnections = maxIdelConnections;
    }
}
